package com.elitel.frame.base.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.elitel.frame.base.service.SysValidationService;
import com.elitel.frame.main.dao.SysValidationMapper;
import com.elitel.frame.main.dao.ext.ExtSysValidationMapper;
import com.elitel.frame.main.entity.SysValidation;

/**
 * @Description 校验规则维护服务接口实现类
 * @author guoyanfei
 * @date 2018/01/05
 */
@Service
public class SysValidationServiceImpl implements SysValidationService {
	@Autowired
	private SysValidationMapper sysValidationMapper;
	@Autowired
	private ExtSysValidationMapper extSysValidationMapper;
	
	@Override
	public Integer insertValidation(SysValidation sysValidation) {
		return sysValidationMapper.insertSelective(sysValidation);
	}

	@Override
	public Integer updateValidation(SysValidation sysValidation) {
		return sysValidationMapper.updateByPrimaryKeySelective(sysValidation);
	}

	@Override
	public Integer deleteValidation(String guids) {
		Integer result = 0;
		String[] guidArray = guids.split(",");
		for (String str : guidArray) {
			result += sysValidationMapper.deleteByPrimaryKey(str);
		}
		return result;
	}

	@Override
	public List<SysValidation> selectAllValidation(String searchtxt) {
		return extSysValidationMapper.getAllValidation(searchtxt);
	}

	@Override
	public SysValidation selectValidationBycode(String validatecode) {
		return sysValidationMapper.selectByPrimaryKey(validatecode);
	}


}
